

import java.awt.Color;
import java.awt.Graphics;
import static skalowanie.Skalowanie.*;
import java.awt.Image;
import java.awt.image.ImageObserver;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.*;

@SuppressWarnings("serial")
public class Przycisk extends JButton implements ImageObserver {
    Image image, image2;
    String tekst;
    Przycisk(String s){
        super();
        try{
           image=ImageIO.read(new File(s)); 
           setBorderPainted(false);
        }
        catch(IOException e){    
        }        
    }
    public String tekst(){
        return tekst;
    }
    protected void paintComponent(Graphics g){
        super.paintComponent(g);
        image2=przeskalujObraz(image,getWidth(),getHeight());
        g.drawImage(image2,0,0,this);  
    } 
      
}